<?php
error_reporting(0);

if (isset($_GET['url'])) {
	$url = urldecode($_GET['url']);
	
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PROPFIND");
	curl_setopt($ch, CURLOPT_HTTPHEADER, array ("Depth: 0"));
	// accept self-signed SSL certificate
	$self_signed_SSL = array('https://svn.paradoxsystems.net/',
	                         'https://poring.netvor.tk/svn/eathena-mirror/');
	if (in_array($url, $self_signed_SSL)) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	
	$repo = curl_exec($ch);
	curl_close($ch);
	
	// <lp3:repository-uuid>54d463be-8e91-2dee-dedb-b68131a5f0ec</lp3:repository-uuid>
	$repo = explode('repository-uuid', $repo);
	$uuid = substr($repo[1], 1,36);
	
	header("Content-Type: text/plain");
	echo $uuid;
}

exit;
?>
